package com.crape.topic.dao.impl;

import org.springframework.stereotype.Service;

import com.crape.common.exceptions.DAOException;
import com.crape.common.ibatis.SqlMapClientDaoSupportEx;
import com.crape.common.model.SubjectRef;
import com.crape.topic.dao.ISubjectRefDAO;

@Service
public class SubjectRefDAOImpl extends SqlMapClientDaoSupportEx implements ISubjectRefDAO {

	@Override
	public Integer countSubjectRefs(Long subjectid) throws DAOException {
		if (subjectid == null) {
			return null;
		}
		return (Integer) this.queryObject("countSubjectRefsById", subjectid);
	}

	@Override
	public Integer countSubjectRefs(SubjectRef topicRef) throws DAOException {
		if (topicRef == null) {
			return null;
		}
		return (Integer) this.queryObject("countSubjectRefs", topicRef);
	}

	@Override
	public void insertSubjectRef(SubjectRef topicRef) throws DAOException {
		if (topicRef == null) {
			return;
		}
		this.insert("insertSubjectRef", topicRef);
	}

	@Override
	public void deleteSubjectRef(SubjectRef topicRef) throws DAOException {
		if (topicRef == null) {
			return;
		}
		this.delete("deleteSubjectRef", topicRef);
	}

	@Override
	public void backupSubjectRef(SubjectRef topicRef) throws DAOException {
		if (topicRef == null) {
			return;
		}
		this.insert("backupSubjectRef", topicRef);
	}

}
